/**
   \file  lazebnik_driver.hh
   \brief Test-drive the lazebnik algorithm.

   This file defines a class that encapsulates the details of driving the
   gist::lazebnik algorithm.
*/

/*
   This file is part of libgist.

   libgist is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   libgist is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with libgist; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

/*
   REVISION HISTORY

   $HeadURL: http://libgist.googlecode.com/svn/branches/siagian_dev/drv/lazebnik_driver.hh $
   $Id: lazebnik_driver.hh 53 2011-09-01 08:09:28Z libgist@gmail.com $
*/

#ifndef GISTDRV_LAZEBNIK_DRIVER_DOT_HH
#define GISTDRV_LAZEBNIK_DRIVER_DOT_HH

//------------------------------ HEADERS --------------------------------

// gistdrv
#include "algorithm_tester.hh"
#include "factory.hh"

// libgist
#include "lazebnik.hh"

// Standard C++
#include <string>

//----------------------- NAMESPACE DEFINITION --------------------------

namespace gistdrv {

//------------------------- CLASS DEFINITION ----------------------------

/**
   \brief Encapsulates the details of test-driving the lazebnik
   algorithm.

   NOTE: As this class simply implements the interface specified by the
   algorithm_tester class, it possesses no publicly accessible interface
   of its own, i.e., all its data members and methods are private.
*/
class lazebnik_driver: public algorithm_tester {
   // Boilerplate code to make factory pattern work
   friend  class subfactory<lazebnik_driver, algorithm_tester> ;
   typedef register_factory<lazebnik_driver, algorithm_tester> my_factory ;
   static  my_factory register_me ;

   /// This driver is meant to test-drive libgist's implementation of the
   /// lazebnik algorithm.
   gist::lazebnik m_lazebnik ;

   /// A private constructor because these objects are created by a
   /// factory and cannot be instantiated directly by clients.
   lazebnik_driver() ;

   /**
      \brief Collect training images for the lazebnik algorithm.
      \param cat The category to which the image belongs.
      \param img The name of the file in which the training image is stored.

      This method loads the specified image file and passes it to the
      lazebnik algorithm.
   */
   void collect_training_data(const std::string& cat, const std::string& img) ;

   /**
      \brief Train the lazebnik algorithm.

      This method trains the lazebnik algorithm, producing the vocabulary
      of prototypical SIFT descriptors plus an SVM classifier to help
      classify images into different categories.
   */
   void train() ;

   /**
      \brief Save the lazebnik algorithm's training results.

      Once the lazebnik algorithm has been trained, this method saves the
      resulting SIFT descriptors vocabulary and SVM classifier for later
      use in image classification.
   */
   void save_training_results() ;

   /// Clean-up.
   ~lazebnik_driver() ;
} ;

//-----------------------------------------------------------------------

} // end of namespace encapsulating this file's definitions

#endif

/* So things look consistent in everyone's emacs... */
/* Local Variables: */
/* indent-tabs-mode: nil */
/* End: */

